package com.fanjun.learning.multithread.Activity_Object_Pattern;

/**
 * Created by fanjun on 16/10/17.
 */
public class Proxy implements ActivityObject{
    private final SchedulerThread scheduler;
    private final Servant servant;
    public Proxy(SchedulerThread scheduler, Servant servant) {
        this.scheduler = scheduler;
        this.servant = servant;
    }

    public Result makeString(int count, char fillChar) {
        FutureResult future = new FutureResult();
        scheduler.invoke(new MakingStringRequest("MakeString",servant, future, fillChar, count));
        return future;
    }

    public void displayString(String value) {
        scheduler.invoke(new DisplayStringRequest("DisplayString",servant, value));
    }
}
